package com.smartmedical.patient.share.service.Impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.smartmedical.common.core.domain.HealthR;
import com.smartmedical.patient.share.domain.*;
import com.smartmedical.patient.share.mapper.KnowledgeBaseMapper;
import com.smartmedical.patient.share.service.KnowledgeBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
@DS("slave")
public class KnowledgeBaseServiceImpl implements KnowledgeBaseService {
    @Autowired
    private KnowledgeBaseMapper knowledgeBaseMapper;

    @Override
    public HealthR<List<Department>> findDepartment() {
        // 获取
        return HealthR.ok(knowledgeBaseMapper.findDepartment());
    }

    @Override
    public HealthR<List<DiseaseCategory>> DiseaseSearch(int departmentId) {
        // 获取疾病知识
        return HealthR.ok(knowledgeBaseMapper.DiseaseSearch(departmentId));

    }

    @Override
    public HealthR<DiseaseKnowledge> findDiseaseKnowledge(int id) {
        // 获取疾病知识
        return HealthR.ok(knowledgeBaseMapper.findDiseaseKnowledge(id));

    }

    @Override
    public HealthR<List<DrugsCategory>> findDrugsCategoryList() {
        // 获取所有药品类别
        return HealthR.ok(knowledgeBaseMapper.findDrugsCategoryList());

    }

    @Override
    public HealthR<List<DrugsKnowledge>> findDrugsKnowledgeList(int drugsCategoryId) {
        List<DrugsKnowledge> list = knowledgeBaseMapper.findDrugsKnowledgeList(drugsCategoryId);
        // 获取药品知识
        return HealthR.ok(list);
    }

    @Override
    public HealthR<DrugsKnowledge> findDrugsKnowledge(int id) {
        return HealthR.ok(knowledgeBaseMapper.findDrugsKnowledge(id));
    }
}
